﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 人事工资管理系统
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }
        public string User; 
        public string times;
        public string power;
        public string Logintime;
        PMSClass.DBOperate operate = new PMSClass.DBOperate();

        private void FormMain_Load(object sender, EventArgs e)
        {
            toolStripStatusLabel2.Text = User;
            toolStripStatusLabel4.Text = Logintime;
            toolStripMenuItem1.Text = DateTime.Now.ToLongTimeString();
            string sql = "select * from tb_User where UserName='" + User + "'";
            DataSet ds = operate.GetTable(sql);
            string power = ds.Tables[0].Rows[0][3].ToString();
            if (power == "1")
            {
                系统管理DToolStripMenuItem.Enabled = false;
                用户管理UToolStripMenuItem.Enabled = false;
            }
            

        }

        private void 档案管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmEmployee employee = new frmEmployee();
            employee.ShowDialog();
        }

        private void 修改口令ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmChangePwd changepwd = new frmChangePwd();
            changepwd.MdiParent = this;
            changepwd.Name = User;
            changepwd.Show();
        }

        private void 更改操作员ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmChangeUser changeuser = new frmChangeUser();
            changeuser.MdiParent = this;
            changeuser.Show();
        }

        private void 退出HToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确定退出本系统吗？", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
            {
                Application.Exit();
            }
        }

        private void 奖罚管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmUserPrize UserPrize = new frmUserPrize();
            UserPrize.ShowDialog();
        }

        private void 操作员管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmOperator operator1 = new frmOperator();
            operator1.MdiParent = this;
            operator1.Show();
        }

        private void 调动管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmUserRedeploy UserRedeploy = new frmUserRedeploy();
            UserRedeploy.ShowDialog();
        }

        private void 考评管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmUserCheck UserCheck = new frmUserCheck();
            UserCheck.ShowDialog();
        }

        private void 考勤津贴ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmUserKqManage UserkqManage = new frmUserKqManage();
            UserkqManage.ShowDialog();
        }

        private void 工资总结ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmUserPay UserPay = new frmUserPay();
            UserPay.ShowDialog();
        }

        private void 部门管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmDepManager DepManager = new frmDepManager();
            DepManager.ShowDialog();
        }


        
    }
}
